function bubbleSort (array) {
  for (let i = 0, len = array.length; i < len; i++) {
    for (let j = 0, len = array.length; j < len - 1; j++) {
      if (array[i] < array[j]) {
        const temp = array[i]
        array[i] = array[j]
        array[j] = temp
      }
    }
  }
  return array
}
let sortRst = bubbleSort([4, 2, 1, 6, 7])
console.log(sortRst);
// 时间复杂度最高on2